<?php
//set_time_limit(0);
//include "pdo.php";
//$str=file_get_contents('http://dianying.114la.com/?kz');
////echo $str;
//$preg='#SB part.*footer#isU';
//preg_match($preg,$str,$arr);
////print_r($arr);die;
//$preg_content='#<li>.*<a href="(.*)" .*>.*<div class=".*">.*<h2>(.*)</h2>.*<p>(.*)</p>.*<span class=".*">.*<b>.*</b>.*</span>.*</div>.*<span>.*<em>.*</em>.*<b>(.*)</b>.*</span>.*<i class=".*">.*</i>.*<div class=".*">.*<b>.*</b>.*</div>.*</a>.*</li>#isU';
//preg_match_all($preg_content,$arr[0],$arr_preg);
//$pdo=new pdo1();
//foreach($arr_preg[1] as $k=>$v)
//{
//    $arr_pp['movie_url']=$arr_preg[1][$k];
//    $arr_pp['movie_name']=$arr_preg[2][$k];
//    $arr_pp['movie_jianjie']=$arr_preg[3][$k];
//    $arr_pp['movie_score']=$arr_preg[4][$k];
//    $pdo->insert($arr_pp,'movie');
//}
//include "pdo.php";
$str= file_get_contents('http://v.114la.com/movie/40088430.html');
//echo $str;
$preg='#<div class="detail part">.*<div class="mv">#isU';
preg_match($preg,$str,$arr);
//print_r($arr);die;
$preg_info = '# <div class="movie_minHeight">.*<div class="_ti">.*<h2>(.*)</h2>.*</div>.*<ul class=".*">.*<li class="sin">.*</li>.*<li class=".*">导演：(.*)</li>.*<li class="norrow_zy">主演：(.*)</li>.*<li class="sin">类型：(.*)</li>.*<li>国家/地区：(.*)</li>.*<li class="sin">.*</li>.*<li>年代：(.*)</li>.*</ul>.*<p class="dt detail_dt" id="intro">.*</p>.*</div>#isU';
preg_match_all($preg_info,$arr[0],$preg_gg);
//print_r($preg_gg);die();
//$pdo=new pdo1();
foreach($preg_gg[1] as $k=>$v)
{
    $arr_preg['movie_name']=$preg_gg[1][$k];
    $arr_preg['movie_director']=$preg_gg[2][$k];
    $arr_preg['movie_act']=$preg_gg[3][$k];
    $arr_preg['movie_type']=$preg_gg[4][$k];
    $arr_preg['movie_ground']=$preg_gg[5][$k];
    $arr_preg['movie_time']=$preg_gg[6][$k];
    $dbh=new PDO('mysql:host=localhost;dbname=gaofei','root','root');
    $sql="insert into moviess(movie_name,movie_director,movie_act,movie_type,movie_ground,movie_time) VALUES ('{$arr_preg['movie_name']}','{$arr_preg['movie_director']}','{$arr_preg['movie_act']}','{$arr_preg['movie_type']}','{$arr_preg['movie_ground']}','{$arr_preg['movie_time']}')";
    $dbh->exec($sql);
    //$pdo->insert($arr_preg,'moviess');

}





























